<template>
  <div class="simple-vite">
    <img src="./img/logo.svg" alt="" />
    <br />
    <button @click="reverseMessage">反转 Message</button>
    <br />
    <div class="message">
      <transition name="fade" mode="out-in">
        <h1 :key="message">{{ message }}</h1>
      </transition>
    </div>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      message: 'simple vite!',
    }
  },
  methods: {
    reverseMessage() {
      this.message = this.message.split('').reverse().join('')
    },
  },
}
</script>

<style lang="less" scoped>
.simple-vite {
  margin: 100px auto;
  text-align: center;

  img {
    width: 30%;
  }

  .message {
    display: inline-block;
    margin-top: 10px;
    padding: 10px;
    background-color: #87fda8;
  }

  h1 {
    color: #bc53ff;
  }
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>
